package com.springbootbooks.common;

import lombok.Data;

@Data
public class Result<T> {
    /**
     * @Description:  错误码
     * @Author: liangfeng
     * @Date:  2021/12/3
     * @Time: 19:46
     * @eamil: 493033932@qq.com
     */
    private Integer code;
    /**
     * @Description:  提示信息
     * @Author: liangfeng
     * @Date:  2021/12/3
     * @Time: 19:46
     * @eamil: 493033932@qq.com
     */
    private String msg;
    /**
     * @Description:  返回的内容
     * @Author: liangfeng
     * @Date:  2021/12/3
     * @Time: 19:47
     * @eamil: 493033932@qq.com
     */
    private T date;

    public Result(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    public Result() {
    }
    public Result setDate(T date) {
        this.date = date;
        return this;
    }
    public Result<T> setMsg(String msg){
        this.msg=msg;
        return this;
    }
    public static Result getSuccess(){

        return new Result(200,"成功");
    }

    public static Result getFailure(){
        return new Result(500,"失败");
    }
}
